import React from 'react'
// import './config/AxiosConfig'
// import './config/MomentConfig';
// import './config/ReactotronConfig';
import createLoading from 'dva-loading'
import dva from 'dva-no-router'
import models from './models'
import App from './App'
import { Toast } from 'antd-mobile'
import {  AsyncStorage } from 'react-native'
import { persistStore, autoRehydrate } from 'redux-persist'

const app = dva({
    onError(error) {
        error.preventDefault()
        Toast.fail(error.toString(), '1')
    },
    extraEnhancers: [autoRehydrate()],
})
app.use(createLoading())
models.map(m => app.model(m))
app.router(() => <App />)

const ThishApp = app.start()
persistStore(app._store, {
    storage: AsyncStorage,
    blacklist: ['router', 'chapter'],
})

export default ThishApp
